package com.example.blogdemo.aync;

import com.alibaba.fastjson.JSONObject;
import com.example.blogdemo.service.JedisService;
import com.example.blogdemo.util.RedisKeyUntil;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author Anita
 * @Date 2017/12/21 15:10
 */
@Service
public class EventProducer {

    @Autowired
    private JedisService jedisService;

    // CommentController中调用
    public void fireEvent(EventModel eventModel){
        String json = JSONObject.toJSONString(eventModel);
        String key = RedisKeyUntil.getEventQueue();
        jedisService.lpush(key,json);
    }
}
